Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bitmasked-option for tbr analysis #808

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

vaithak
Copy link
Collaborator

@vaithak vaithak commented Mar 8, 2024

No description provided.

Copy link

codecov bot commented Mar 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.92%. Comparing base (d7e5434) to head (c4b8c00).
Report is 4 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #808      +/-   ##
==========================================
+ Coverage   94.89%   94.92%   +0.02%     
==========================================
  Files          49       49              
  Lines        7478     7502      +24     
==========================================
+ Hits         7096     7121      +25     
+ Misses        382      381       -1     
Files Coverage Δ
include/clad/Differentiator/CladConfig.h 100.00% <100.00%> (ø)
include/clad/Differentiator/DiffPlanner.h 100.00% <ø> (ø)
include/clad/Differentiator/Differentiator.h 100.00% <ø> (ø)
lib/Differentiator/DiffPlanner.cpp 98.57% <100.00%> (+0.33%) ⬆️
tools/ClangPlugin.cpp 94.02% <100.00%> (+0.18%) ⬆️
tools/ClangPlugin.h 90.16% <100.00%> (+1.48%) ⬆️
Files Coverage Δ
include/clad/Differentiator/CladConfig.h 100.00% <100.00%> (ø)
include/clad/Differentiator/DiffPlanner.h 100.00% <ø> (ø)
include/clad/Differentiator/Differentiator.h 100.00% <ø> (ø)
lib/Differentiator/DiffPlanner.cpp 98.57% <100.00%> (+0.33%) ⬆️
tools/ClangPlugin.cpp 94.02% <100.00%> (+0.18%) ⬆️
tools/ClangPlugin.h 90.16% <100.00%> (+1.48%) ⬆️

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

tools/ClangPlugin.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

github-actions bot commented Mar 8, 2024

clang-tidy review says "All clean, LGTM! 👍"

@vaithak vaithak linked an issue Mar 8, 2024 that may be closed by this pull request
tools/ClangPlugin.cpp Outdated Show resolved Hide resolved
Copy link
Owner

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, but I'd wait for @PetroZarytskyi's review.

@vgvassilev
Copy link
Owner

I am wondering if we could draw some inspiration from LLVM's BitmaskEnum?

@vaithak
Copy link
Collaborator Author

vaithak commented Mar 11, 2024

I am wondering if we could draw some inspiration from LLVM's BitmaskEnum?

I went through their code and read about the BitmaskType in C++?
To confirm, using this approach, we will have 2 benefits:

  • Setting of bit only possible through clad::opts::... enum and not through some other unrelated enums or integer literals.
  • This can help in a single bit for tbr analysis? Disabling using ~clad::opts::tbr_analysis (no separate enable or disable).

Is this correct? If so, I think yeah, we should have an interface using this approach.

tools/ClangPlugin.h Outdated Show resolved Hide resolved
@PetroZarytskyi
Copy link
Collaborator

I am wondering if we could draw some inspiration from LLVM's BitmaskEnum?

I went through their code and read about the BitmaskType in C++? To confirm, using this approach, we will have 2 benefits:

  • Setting of bit only possible through clad::opts::... enum and not through some other unrelated enums or integer literals.
  • This can help in a single bit for tbr analysis? Disabling using ~clad::opts::tbr_analysis (no separate enable or disable).

Is this correct? If so, I think yeah, we should have an interface using this approach.

Wouldn't ~clad::opts::tbr_analysis correspond to "all options enabled except for clad::opts::tbr_analysis"? This would work if we took the bitwise & with this option. But we take the bitwise | which will only lead to all other options being enabled.

@vaithak
Copy link
Collaborator Author

vaithak commented Mar 12, 2024

Wouldn't ~clad::opts::tbr_analysis correspond to "all options enabled except for clad::opts::tbr_analysis"? This would work if we took the bitwise & with this option. But we take the bitwise | which will only lead to all other options being enabled.

Ah, Good catch, thanks for pointing this out.
Then, yeah, we should have two separate options only (enable, and disable).
Still, I will add some changes for the first benefit - type safety.

@vaithak
Copy link
Collaborator Author

vaithak commented Mar 12, 2024

I am wondering if we could draw some inspiration from LLVM's BitmaskEnum?

My bad, I forgot that we are using the first few bits of this same mask for derivative order too (which is unsigned int or a separate enum order). So, we can't have strict typing :(.

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@vgvassilev
Copy link
Owner

@vaithak, @PetroZarytskyi is that ready to go?

@vgvassilev vgvassilev added this to the v1.5 milestone Mar 13, 2024
@vaithak
Copy link
Collaborator Author

vaithak commented Mar 13, 2024

I have addressed the requested changes, @PetroZarytskyi if this looks good to you then we can go ahead.

@PetroZarytskyi
Copy link
Collaborator

The PR looks good to me. Thank you for the work!

Copy link
Owner

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@vgvassilev vgvassilev merged commit 8a77f81 into vgvassilev:master Mar 13, 2024
83 checks passed
@vaithak vaithak deleted the tbr-option branch March 13, 2024 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a config option for enabling/disabling tbr
3 participants